package geeksforgeeks.trees;

import geeksforgeeks.trees.DepthTree.Node;

public class BSTMinNode {
	
	public static void main(String[] args)
	{
		Node root = new Node(20);

		root.left = new Node(8);
		root.left.left = new Node(4);

		root.left.right = new Node(12);
		root.left.right.left = new Node(10);
		root.left.right.right = new Node(14);

		root.right = new Node(22);
		
		Node min = findMin(root);
		System.out.println(min.data);
		
	}
	
	static Node findMin(Node root)
	{

		if(root.left == null)
			return root;
		else
		 return findMin(root.left);
	
	}

}
